#pragma once

#include<iostream>
#include<unordered_map>
#include<vector>
#include<string>
#include<functional>

typedef std::function<void(void)> func;
std::vector<func> loadFun;
std::unordered_map<int, std::string> um;        //int类型的数据放第一个，输出时更美观

void ReadMySQL()
{
    std::cout << "读取数据库" << std::endl;
}

void SaveDigite()
{
    std::cout << "持久化保存数据" << std::endl;
}

void Cal()
{
    std::cout << "计算数据" << std::endl;
}

void Encrypt()
{
    std::cout << "加密数据" << std::endl;
}

void Load()
{
    um.insert(std::make_pair(loadFun.size(), "ReadMySQL : 读取数据库"));
    loadFun.push_back(ReadMySQL);

    um.insert(std::make_pair(loadFun.size(), "SaveDigite : 持久化保存数据"));
    loadFun.push_back(SaveDigite);

    um.insert(std::make_pair(loadFun.size(), "Cal : 计算数据"));
    loadFun.push_back(Cal);

    um.insert(std::make_pair(loadFun.size(), "Encrypt : 加密数据"));
    loadFun.push_back(Encrypt);
}

void Show()
{
    for(int i = 0; i < um.size(); ++i)
    {
        std::cout << i << ". " << um[i] << std::endl;
    }
}

int HandlerSize()
{
    return loadFun.size();
}